package com.springboot.demo.common;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.springboot.demo.common.utils.ExcelUpload;
import com.springboot.demo.common.utils.HttpRequest;
import com.springboot.demo.entity.ChbUser;

@SuppressWarnings("all")
public class ExcelTest {
	
	public static void main(String[] args) throws IOException {
		File tempFile = new File("D://excel/test2.xlsx");
		List<ChbUser> userList = ExcelUpload.readExcelValue(tempFile);
		
		try {
		    for (int i = 0; i <userList.size() ; i++) {
		    	Map<String, String> map = new HashMap<String, String>();
		        map.put("phoneNumber",userList.get(i).getPhoneNumber());
		        map.put("nickName",userList.get(i).getNickName());
		        map.put("headImageUrl",userList.get(i).getHeadImageUrl());
		        JSONObject obj = new JSONObject();
		        obj.putAll(map);
		        String akz=HttpRequest.qztPost(obj.toString());
		        System.out.println("第"+(i+1)+"次导入,结果"+akz);
		    }
		}catch (Exception e){
		    System.out.println("mmp");
		}
	}
}
